<template>
<div class="main">
	<content_top title="操作日志"></content_top>
	
	<div class="g_box">
		<div class="g_head">
			<h3>筛选查询</h3>
			<div class="g_box_right">
				<ButtonGroup class="g_act_box">
					<Button @click="query">查询结果</Button>
				</ButtonGroup>
				<div class="g_other">
					<a @click="clear_data">清除筛选</a>
				</div>
			</div>
		</div>
		<div class="g_box_con" style="padding:20px;">
			<Form  :label-width="110" style="width: 100%" inline>
				<FormItem label="操作人员：">
					<user_filter v-model="filter.admin_id" ></user_filter>
				</FormItem>
				
				
				<FormItem label="操作日期：">
					<DatePicker type="daterange" placeholder="请选择日期" style="width: 200px" @on-change="date_change"></DatePicker>
				</FormItem>
				<FormItem label="关键词搜索：">
					<Input v-model="filter.keyword" placeholder="请输入关键词" style="width: 200px"></Input>
				</FormItem>
			</Form>
		</div>
	</div> 
	 
	<div class="g_box">
		<div class="g_head">
			<h3>数据列表</h3>
		</div>
		<div class="g_box_con">
			<Table :columns="Columns" :data="list" style="width: 100%;" border >
				<div slot="footer" style="border-top: 1px solid #eee;padding: 0 10px; text-align: right;    font-size: 14px;">
					
					<div style="float:right;">
						<Page :total="count" show-elevator show-total @on-change="goto_page" />
					</div>
				</div>
			</Table>
		</div>
	</div>
</div>
</template>

<script>
import user_filter from '@/themes/components/user_filter';

export default {
    data () {
		var self = this;
        return {
            Columns: [
				{
					title: '编号',
					key: 'id',
					align: 'center',
                    width: 100
                },
				{
                    title: '操作者',
					key: 'admin_name',
					align: 'center',
					width: 150,
                },
				{
                    title: '操作日期',
					key: 'addtime',
					width: 150,
                },
				{
                    title: 'IP地址',
					key: 'ip',
					width: 150,
                },
				{
                    title: '操作板块',
					key: 'module',
					width: 150,
                },
				{
                    title: '操作记录',
					key: 'msg',
                },
            ],
			list:[],
			page:1,
			count:0,
			filter:{
				admin_id:0,
				start_time:'',
				end_time:'',
				keyword:''
			}
        };
    },
	components:{
		user_filter
	},
	created(){
		this.load_data();
	},
    methods: {
		load_data(){
			var self = this;
			var postdata = {
				page:this.page,
				f:this.filter
			};
			Whttp.load('System/Logs/get_list',postdata,function(result){
				self.list = result.list;
				self.count = parseInt(result.count);
			});
		},
		goto_page(page){
			this.page = page;
			this.load_data();
		},
		query(){
			this.page = 1;
			this.load_data();
		},
		date_change(dates){
			this.filter.start_time = dates[0];
			this.filter.end_time = dates[1];
		},
		clear_data(){
			this.filter = this._getData(this.default_filter);
		}
    }
};
</script>

